<?php

/**
 * Lev.levme.com [ 专业开发各种Discuz!插件 ]
 *
 * Copyright (c) 2013-2014 http://www.levme.com All rights reserved.
 *
 * Author: Mr.Lee <675049572@qq.com>
 *
 * Date: 2013-02-17 16:22:17 Mr.Lee $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

class baidu_module {

	public static function __map() {
		header("Content-Type: text/html; charset=utf-8");
		$PLSTATIC = lev_base::$PLSTATIC;
		$remote   = lev_base::$remote;
		$lm   = lev_base::$lm;
		include template('levmap:baidu');
	}
	
	public static function __mapimg() {
		$width  = $_GET['width'] >0 ? $_GET['width'] : 400;
		$height = $_GET['height'] >0 ? $_GET['height'] : 400;
		$points = explode('|', $_GET['points']);
		$zoom   = $points[0] >0 ? $points[0] : 12;
		$center = $points[1] ? $points[1] : '106.555697,29.556102';
		return "http://api.map.baidu.com/staticimage?width=$width&height=$height&center=$center&markers=$center&zoom=$zoom&markerStyles=l,A,0xff0000";
	}
	
	public static function artmap() {
		$lev_lang = lev_base::$lang;
		$lm2 = lev_base::$lm2;
		$js = <<<EOF
<div id="mapzb"></div>
<a href="javascript:;" onclick="baidumap()">bai du map</a>

<script type="text/javascript">
function baidumap() {
	var data = '<iframe width="960" scrolling="no" height="600" frameborder="0" marginheight="0" src="{$lm2}baidu.__map"></iframe>';
	art.dialog({id:'baidumap', content:data, padding:0, ok:function(){
		if (!jQuery('#mapzb').html()) {
			art.dialog.tips('{$lev_lang[error]}no map point!');
			return false;
		}
	}, cancel:true});
}
</script>
EOF;
		return $js;
	}
	
}







